package com.example.goods_service.controller;

import com.example.goods_service.service.GoodsService_zhoufuyu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class GoodsController_zhoufuyu {
    @Autowired
    GoodsService_zhoufuyu goodsService_zhoufuyu;

    @RequestMapping("/upgoods")
    public String upgoods(@RequestParam("commodity_name") String commodity_name,
                          @RequestParam("commodity_description") String commodity_description,
                          @RequestParam("commodity_picture") int commodity_picture,
                          @RequestParam("commodity_price") double commodity_price,
                          @RequestParam("status") String status,
                          @RequestParam("id") int id ){
        int n = goodsService_zhoufuyu.upgoods(commodity_name, commodity_description, commodity_picture, commodity_price, status, id);
        if (n>0){
        return "商品信息修改成功";
        }
        return "商品信息修改失败";
    }
}
